package main

import "fmt"

type Student struct {
	id     int
	name   string
	age    int
	weight int
	source map[string]int
}

func modifyName(stu *Student) {
	stu.name = "修改后"
}

func main() {

	var student01 = Student{
		id:     1,
		name:   "张三",
		age:    21,
		weight: 53,
		source: map[string]int{
			"语文": 95,
			"数学": 75,
			"英语": 89,
		},
	}
	fmt.Println(student01)

	var student02 = new(Student)
	student02.id = 2
	student02.name = "李四"
	student02.age = 22
	student02.weight = 55
	student02.source = map[string]int{
		"语文": 95,
		"数学": 75,
		"英语": 89,
	}
	fmt.Println(student02)

	var source = map[string]int{
		"语文": 95,
		"数学": 75,
		"英语": 89,
	}

	var student03 = new(Student)
	*student03 = Student{
		id:     3,
		name:   "王五",
		age:    23,
		weight: 59,
		source: source,
	}
	fmt.Printf("%s有%d门学科\n", student03.name, len(student03.source))

	fmt.Printf("%s有%d门学科\n", student03.name, len((*student03).source))

	student04 := &Student{
		id:     4,
		name:   "赵六",
		age:    23,
		weight: 59,
		source: source,
	}

	modifyName(student04)
	fmt.Printf(student04.name)

}
